package com.jyx.file_system.controller;

import com.jyx.api.filesystem.FileSystemControllerApi;
import com.jyx.file_system.service.FileSystemService;
import com.jyx.framework.domain.filesystem.response.UploadFileResult;
import com.jyx.framework.model.response.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/filesystem")
public class FileSystemController implements FileSystemControllerApi {
    @Autowired
    FileSystemService fileSystemService;


    @Override
    @PostMapping("/upload")
    public UploadFileResult upload(@RequestParam("file") MultipartFile multipartFile,
                                   @RequestParam(value = "filetag",required = true) String filetag,
                                   @RequestParam(value = "businesskey",required = false)String businesskey,
                                   @RequestParam(value = "metadata",required = false)String metadata) {
        return fileSystemService.upload(multipartFile,filetag,businesskey,metadata);
    }



}
